<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <button id="btn">下单了</button>
    <button id="load">加载更多</button>
    <script>
        // 防抖函数
        // 防止频繁点击
        function debounce(fn, delay) {
            let timer = null;
            return function () {
                clearTimeout(timer);
                timer = setTimeout(()=>{
                    fn()
                }, delay)
            }
        }

        function a() {
            console.log('下单了')
        }

        let btn = document.getElementById('btn');
        let load = document.getElementById('load');
        btn.onclick = debounce(a, 1000)
        load.onclick = debounce(()=>{
            console.log('加载更多')
        }, 1000)
    </script>
</body>
</html>